#include <GL/gl.h>
#include "Camera.h"
#include "CameraMode.h"

Camera::Camera() {
    _modes["fly"] = new CameraMode();
    _current_mode = 0;
}

Camera::~Camera() {
    for (unordered_map<string, CameraMode*>::iterator it = _modes.begin();
            it != _modes.end(); ++it) {
        delete it->second;
    }
}

void Camera::set_mode(string mode) {
    if (_current_mode) {
        _current_mode->pause();
    }
    _current_mode = _modes[mode];
    _current_mode->resume();
}

void Camera::apply_camera_transform() {
    _current_mode->apply();
}

void Camera::input(SDL_Event* evt, unsigned int ms) {
    _current_mode->input(evt, ms);
}

void Camera::update(unsigned int ms) {
    _current_mode->update(ms);
}
